<%@ page language="java" import="java.util.*,java.text.*,other.*" pageEncoding="utf-8"%>
<%
   List UnKnowFileListRows=(List)session.getAttribute("UnKnowFileListRows");
   String UnKnowFileBeginTime=(String)session.getAttribute("UnKnowFileBeginTime");
   String UnKnowFileEndTime=(String)session.getAttribute("UnKnowFileEndTime");
   String UnKnowFileStrSQL=(String)session.getAttribute("UnKnowFileStrSQL");
   GetYToday T=new GetYToday();
   SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); 
   SimpleDateFormat sdft=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");    
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>    
	<head>
		<title>不识别文件名修改</title>
		<link rel="stylesheet" type="text/css" media="all" href="skins/aqua/theme.css" />
		<link type="text/css" rel="stylesheet" href="JSDate/skin/WdatePicker.css" />
        <script type="text/javascript" src="JS/calendar.js"></script>
        <script type="text/javascript" src="JS/calendar-en.js"></script>
		<script type="text/javascript" src="JS/calendar-setup.js"></script>
		<script type="text/javascript" src="JSDate/WdatePicker.js"></script>
		<script type="text/javascript">
		    var xmlHttp = null;
			function GetXmlHttpObject() {		
			try {
				xmlHttp = new XMLHttpRequest();
			} catch (e) {
				try {
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
			return xmlHttp;
		   }		
		   function modifyfilename(idname,id,sfilename,sdir,ddate){
		      xmlHttp = GetXmlHttpObject();
		      if (xmlHttp == null) {
			      alert("you browser don't support the ajax");
			      return;
		      }		   
			  var obj1=document.getElementById(idname).value;
			  if (obj1==''){
			    alert("修改后的文件名不能为空!!!");
			    return;
			  }
			  var checkurl="UnKowFileAction.jsp?rowid="+id;
		      checkurl=checkurl+"&sfilename="+sfilename;	
		      checkurl=checkurl+"&FDir="+sdir;
		      checkurl=checkurl+"&Mfilename="+obj1;
		      checkurl=checkurl+"&sid="+ Math.random();
		      
			  xmlHttp.onreadystatechange = stateChanged;
              xmlHttp.open("GET", checkurl, true);                          
		      xmlHttp.send(null);			            
			  //var checkurl="UnKowFileAction.jsp?rowid="+id+"&sfilename="+sfilename+"&FDir="+sdir+"&Mfilename="+obj1;
		   		   
		   }
		   function stateChanged(){
		     if(xmlHttp.readyState==4){
			    if(xmlHttp.status==200){
		          window.alert("文件名修改成功!");
			    }else{
			      window.alert("文件名修改失败!");
			    }
			  }
			}		   
		</script>						
    </head>
  <body>    
    <div align="center"><h2>未识别文件名修改</h2></div>
    <div align="center">
       <form action="QueryUnKnowFile.jsp" method="post" name="frmurgequery">	   
	    <table border="1" width="100%">
	       <tr>
	         <td width="75">开始时间:</td>
	         <td width="60">
	           <input type="text"  name="begintime" id="begintime" value="<%=T.getCDate()%>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" style="cursor:hand"></input>
	         </td>
	         <td width="75">结束时间:</td>
	         <td width="60">
	           <input type="text"  name="endtime" id="endtime" value="<%=T.getCDate()%>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" style="cursor:hand"></input>
	         </td>	         
			 <td width="60" align="center">
				<input type="submit" name="query" id="query" value="查   询"></input>
			 </td>
	       </tr>
	    </table>      
     </form>	   
    </div>
    <div align="center">
	    <table border="1" width="100%">
		   <tr>
		      <td width="150" align="center">原文件名</td>
		      <td width="200" align="center">文件路径</td>
		      <td width="150" align="center">修改后文件名</td>
		      <td width="100" align="center">日期</td>
		      <td width="70" align="center">操作</td>
		   </tr>
		   <% if((UnKnowFileListRows!=null) || (UnKnowFileListRows.size()==0)){                
		         for(int k=0;k<UnKnowFileListRows.size();k++){
		             String s=UnKnowFileListRows.get(k).toString();
		             s=s.replace("]","");
		             s=s.replace("[","");
		             String[] m=s.trim().split(",");                                 	     	           
		   %> 
		   <tr>
			  <td align="center"><%=(String)m[0]%></td>
			  <td align="center"><%=(String)m[1]%></td>
			  <% if (m[2]!=null) { %>
			  <td align="center"><input type="text" id="<%=k%>" name="<%=k%>" value="<%=(String)m[2]%>"></input></td>
			  <%} else {%> 
			  <td align="center"><input type="text" id="<%=k%>" name="<%=k%>" value=""></input></td>
			  <%} %>
			  <td><%=(String)m[3]%></td>
			  <td><a href="#"  onClick= "modifyfilename('<%=k%>','<%=(String)m[4]%>','<%=(String)m[0]%>','<%=(String)m[1]%>','<%=(String)m[3]%>');">修  改</a></td>      		            		   
		   </tr>
		   <%}} %>   
	    </table>	    
    </div>
  </body>
</html>